import type { ISelectOptionsType, IHandlerItemData, ITagInputItemData, ITableShowKey } from './type'

export const StatusOptions: ISelectOptionsType[] = [
  {
    label: '不限',
    value: -100
  },
  {
    label: '其他异常',
    value: -4
  },
  {
    label: '手动下架',
    value: -3
  },
  {
    label: '市场下架',
    value: -2
  },
  {
    label: '版本过低',
    value: -1
  },
  {
    label: '审核',
    value: 0
  },
  {
    label: '投放中',
    value: 1
  }
]
// 把渠道放到了public静态文件当中方便后期直接修改
export const ChannerOptions: ISelectOptionsType[] = (window as any).HEMU_CHANNEL_OPTIONS || [] 

export const CPUOptions: ISelectOptionsType[] = [
  {
    label: '全部支持',
    value: ''
  },
  {
    label: '32位包',
    value: '32-Bit'
  },
  {
    label: '64位包',
    value: '64-Bit'
  }
]

export const PkgtypeOptions: ISelectOptionsType[] = [
  {
    label: '未知',
    value: 0
  },
  {
    label: '应用商店包',
    value: 1
  },
  {
    label: '商店渠道包',
    value: 2
  },
  {
    label: '直链下载包',
    value: 3
  }
]

const generatePublishOptions = ():ISelectOptionsType[] => {
  const max = 24, targetOptions:ISelectOptionsType[] = [];
  for (let index = 0; index <= max; index++) {
    targetOptions.push({
      label: `${index}`,
      value: `${index}`
    })
  }
  return [ ...targetOptions ];
}
export const PublishOptions: ISelectOptionsType[] = generatePublishOptions();

export enum HANDLE_TYPE_ENUM {
  TYPE_ADD = 'ADD',
  TYPE_UPDATE = 'UPDATE',
  TYPE_DELETE= 'DELETE'
}

export enum PAGE_TYPE_ENUM {
  TYPE_APP_1 = '1',
  TYPE_APP_2 = '2',
  TYPE_APP_3 = '3'
}

export const HandlerItemData: IHandlerItemData[] = [
  {
    label: 'APP名称',
    key: 'name',
    category: 'input',
    type: 'text',
    require: true
  },
  {
    label: '包名',
    key: 'pkg',
    category: 'input',
    type: 'text',
    require: true,
    updateDisabled: true,
  },
  {
    label: 'APP_ID',
    key: 'appid',
    category: 'input',
    type: 'text',
    require: true,
    updateDisabled: true,
  },
  {
    label: '状态',
    key: 'status',
    category: 'select',
    options: StatusOptions.slice(1),
    require: true
  },
  {
    label: 'MD5',
    key: 'md5',
    category: 'input',
    type: 'text',
    require: true,
    updateDisabled: true,
  },
  {
    label: '下载地址',
    key: 'url',
    category: 'input',
    type: 'text',
    require: true
  },
  {
    label: '版本号',
    key: 'vnm',
    category: 'input',
    type: 'text',
    require: true,
    updateDisabled: true,
  },
  {
    label: '版本号数字版',
    key: 'vcd',
    category: 'input',
    type: 'text',
    require: true,
    updateDisabled: true,
  },
  {
    label: '客户',
    key: 'customer',
    category: 'input',
    type: 'text',
    require: true,
    updateDisabled: true,
  },
  {
    label: 'CPU架构',
    key: 'cpuModel',
    category: 'select',
    options: CPUOptions,
    require: false
  },
  {
    label: '包类型',
    key: 'pkgtype',
    category: 'select',
    options: PkgtypeOptions,
    require: false
  },
  {
    label: '广告位列表',
    key: 'detailList',
    category: 'tag-input',
    type: 'custom',
    require: true
  },
  {
    label: '关键词',
    key: 'keywords',
    category: 'input',
    type: 'text',
    require: false
  },
  {
    label: '广告位id',
    key: 'tagid',
    category: 'input',
    type: 'text',
    require: false
  },
  {
    label: '竞价',
    key: 'bidfloor',
    category: 'input',
    type: 'number',
    require: true
  },
  {
    label: '预算',
    key: 'budget',
    category: 'input',
    type: 'number',
    require: true
  },
  {
    label: '下载量',
    key: 'downloadnum',
    category: 'input',
    type: 'number',
    require: true
  },
  {
    label: '渠道',
    key: 'channel',
    category: 'select',
    options: ChannerOptions,
    require: true
  },
  {
    label: '三方的监控链接',
    key: 'mlink',
    category: 'input',
    type: 'text',
    require: false
  },
  {
    label: 'App包大小',
    key: 'size',
    category: 'input',
    type: 'text',
    require: true
  },
  {
    label: 'RTAURL',
    key: 'rtaurl',
    category: 'input',
    type: 'text',
    require: false
  },
  {
    label: '投放开始时间',
    key: 'btime',
    category: 'select',
    options: PublishOptions,
    require: true
  },
  {
    label: '投放结束时间',
    key: 'etime',
    category: 'select',
    options: PublishOptions,
    require: true
  }
]

export const TagInputItemData: IHandlerItemData[] = [
  {
    label: '广告位id',
    key: 'tagid',
    category: 'input',
    type: 'text',
    require: true
  },
  {
    label: '关键词',
    key: 'keyword',
    category: 'input',
    type: 'text',
    require: true
  },
  {
    label: '竞价',
    key: 'bidfloor',
    category: 'input',
    type: 'number',
    require: true
  }
]

export const TagInputItemOriginData: ITagInputItemData = {
  bidfloor: '',
  keyword: '',
  tagid: ''
}


export const HomeTableListShowKey: ITableShowKey[] = [
  {
    title: 'APP名称',
    key: 'name',
    width: '80'
  },
  {
    title: 'APP_ID',
    key: 'appid',
    width: '80'
  },
  {
    title: '包名',
    key: 'pkg',
    width: '90'
  },
  {
    title: 'MD5',
    key: 'md5',
    width: '90'
  },
  {
    title: '下载URL',
    key: 'url',
    width: '100'
  },
  {
    title: '状态',
    key: 'status',
    width: '80'
  },
  {
    title: '版本号',
    key: 'vnm',
    width: '80'
  },
  {
    title: '版本号数字版',
    key: 'vcd',
    width: '80'
  },
  {
    title: '客户',
    key: 'customer',
    width: '80'
  },
  {
    title: 'RTAURL',
    key: 'rtaurl',
    width: '100'
  },
  {
    title: '竞价(元)',
    key: 'bidfloor',
    width: '80'
  },
  {
    title: '预算(元)',
    key: 'budget',
    width: '80'
  },
  {
    title: '下载量',
    key: 'downloadnum',
    width: '80'
  },
  {
    title: '渠道',
    key: 'channel',
    width: '80'
  },
  {
    title: '广告位ID',
    key: 'tagid',
    width: '180'
  },
  {
    title: '包大小',
    key: 'size',
    width: '80'
  },
  {
    title: '三方的监控链接',
    key: 'mlink',
    width: '120'
  },
  {
    title: '备注',
    key: 'msg',
    width: '100'
  },
  {
    title: 'CPU架构',
    key: 'cpuModel',
    width: '80'
  },
  {
    title: '关键词',
    key: 'keywords',
    width: '80'
  },
  {
    title: '包类型',
    key: 'pkgtype',
    width: '100'
  },
  {
    title: '投放时间',
    key: 'btime',
    width: '100'
  }
]